package oneroom.comm;

import java.io.IOException;
import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class IbatisLoader {
	
	  public  static SqlMapClient setConfig(){
		  	SqlMapClient sqlMapper = null;
		  	Reader reader = null;
		    try {
		    	
		      reader = Resources.getResourceAsReader("SqlMapConfig.xml");
		      sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader);
		      reader.close(); 
		    } catch (IOException e) {
		    	try{
		    	reader.close();
		    	} catch(IOException ioe){
		    		ioe.printStackTrace();
		    	}
		    	e.printStackTrace();
		    }
		    
		    return sqlMapper;
	  }
	
}
